package com.rc.saas.mini.common.utils;

/**
 * 故障类型
 */
public class FaultTypeUtils {
    /**
     * 更新状态为枪锁故障
     * @param state
     * @return
     */
    public static int addPileFault(int state) {
        return state | 0x1;
    }


    /**
     * 判断是否时枪锁故障
     * @param state
     * @return
     */
    public static boolean isPileFault(int state) {
        return (state & 0x1) > 0;
    }

    /**
     * 离线
     * @param state
     * @return
     */
    public static int addOutLine(int state) {
        return state | 0x2;
    }


    public static boolean isOutLine(int state) {
        return (state & 0x2) > 0;
    }

    /**
     * 配件损坏
     * @param state
     * @return
     */
    public static int addComponentFault(int state) {
        return state | 0x4;
    }


    public static boolean isComponentFault(int state) {
        return (state & 0x4) > 0;
    }

    /**
     * 电流过低
     * @param state
     * @return
     */
    public static int addLowElectric(int state) {
        return state | 0x8;
    }


    public static boolean isLowElectric(int state) {
        return (state & 0x8) > 0;
    }

    /**
     * 无法启动
     * @param state
     * @return
     */
    public static int addNotStart(int state) {
        return state | 0x10;
    }


    public static boolean isNotStart(int state) {
        return (state & 0x10) > 0;
    }

    /**
     * 其他
     * @param state
     * @return
     */
    public static int addOther(int state) {
        return state | 0x20;
    }


    public static boolean isOther(int state) {
        return (state & 0x20) > 0;
    }
}
